<!--
 * @Description: 
 * @Version: 2.0
 * @Autor: wsh
 * @Date: 2024-04-03 14:27:03
 * @LastEditors: uphldjx 1373577124@qq.com
 * @LastEditTime: 2024-05-17 10:40:01
-->
<template>
  <!-- 社区居家养老服务设施 -->
  <aplid-base-crud ref="crud" class="w-100" v-bind="baseConfig" :operateFormate="onOperateFormate">
    <template v-slot:pageName>
      <h3 style="margin-right: 10px;">{{ baseConfig.pageName }}</h3>
    </template>
  </aplid-base-crud>
</template>

<script setup>
import { ref } from 'vue'
import { baseConfig } from './config'
import apiMod from '@/apiMod'
import { ElMessage } from 'element-plus'
const emits = defineEmits(['demand-refreshTab'])
const props = defineProps({
  nowRowData: {
    type: Object,
    default: () => { }
  }
})

const onOperateFormate = (data, type) => {
  return new Promise((resolve, reject) => {
    if (type == 'add') {
      let parameter = {
        projectId: props.nowRowData.id,
        projectName: props.nowRowData.projectName,
        projectStatus: props.nowRowData.projectStatus,
        belongProject: props.nowRowData.belongProject,
        bindCreditCode: data.soleValue,
        bindOrgId: data.id,
        // bindOrgName: data.unitName,
        bindOrgName: data.soleValue,
        bindType: 1,
      }
      apiMod.view_omProjectCooperate_add(parameter).then((res) => {
        emits('demand-refreshTab')
        ElMessage({
          message: res.data,
          type: 'success',
        })
      })
    } else {
      resolve(data)
    }
  })
}

</script>

<style lang="scss" scoped></style>